package com.xu.demo.proxyPattern;

import java.lang.reflect.Proxy;

// 动态代理类
public class DynamicShoppingProxy {

    public static Shopping createProxy(RealShopping realShopping) {
        return (Shopping) Proxy.newProxyInstance(
                realShopping.getClass().getClassLoader(),
                realShopping.getClass().getInterfaces(),
                new ShoppingInvocationHandler(realShopping));
    }
}

